SVM patch to update guest time with latest hvm modifications.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 29 Mar 2006 12:56:26 +0000 (13:56 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 29 Mar 2006 12:56:26 +0000 (13:56 +0100)
Signed-off-by: Tom Woller <thomas.woller@amd.com>
xen/arch/x86/hvm/svm/intr.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/svm/vmcb.c

index 46de3cd40abf80f3d3415f0a3e33e466688505b1..6d3289e6959a77a535838497d0b356904cb28241 100644 (file)
@@ -81,7 +81,7 @@ interrupt_post_injection(struct vcpu * v, int vector, int type)
         }
         vpit->inject_point = NOW();
 
-        vpit->last_pit_gtime += vpit->period;
+        vpit->last_pit_gtime += vpit->period_cycles;
         svm_set_guest_time(v, vpit->last_pit_gtime);
     }
 
index dcecfda39feee9830722fe384b8ec5f2a3b45501..d43bfb08d8b5d8bafd2c2e688da059febee20cdf 100644 (file)
@@ -674,9 +674,10 @@ static void svm_freeze_time(struct vcpu *v)
 {
     struct hvm_virpit *vpit = &v->domain->arch.hvm_domain.vpit;
     
-    v->domain->arch.hvm_domain.guest_time = svm_get_guest_time(v);
-    if ( vpit->first_injected )
+    if ( vpit->first_injected && !v->domain->arch.hvm_domain.guest_time ) {
+        v->domain->arch.hvm_domain.guest_time = svm_get_guest_time(v);
         stop_timer(&(vpit->pit_timer));
+    }
 }
 
 static void svm_ctxt_switch_from(struct vcpu *v)
index 8b46e104e5d9c934ba99d6d221fb08dfe89dde51..0d101206b616cbc5c4413109fca2fb5ab6cfa327 100644 (file)
@@ -498,8 +498,11 @@ void svm_do_resume(struct vcpu *v)
     svm_stts(v);
     
     /* pick up the elapsed PIT ticks and re-enable pit_timer */
-    if ( vpit->first_injected) {
-        svm_set_guest_time(v, v->domain->arch.hvm_domain.guest_time);
+    if ( vpit->first_injected ) {
+        if ( v->domain->arch.hvm_domain.guest_time ) {
+            svm_set_guest_time(v, v->domain->arch.hvm_domain.guest_time);
+            v->domain->arch.hvm_domain.guest_time = 0;
+        }
         pickup_deactive_ticks(vpit);
     }
 
@@ -511,7 +514,6 @@ void svm_do_resume(struct vcpu *v)
     ASSERT(!test_bit(ARCH_HVM_IO_WAIT, &v->arch.hvm_vcpu.ioflags));
 }
 
-
 void svm_launch_fail(unsigned long eflags)
 {
     BUG();